<?php

namespace Renshan\DetectorBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Target
 *
 * @ORM\Table(name="target")
 * @ORM\Entity(repositoryClass="Renshan\DetectorBundle\Repository\TargetRepository")
 */
class Target
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="title", type="string", length=255)
     */
    private $title;

    /**
     * @var string
     *
     * @ORM\Column(name="url", type="string", length=255)
     */
    private $url;

    /**
     * @var string
     *
     * @ORM\Column(name="method", type="string", length=255)
     */
    private $method;

    /**
     * @var array
     *
     * @ORM\Column(name="headers", type="array", nullable=true)
     */
    private $headers;

    /**
     * @var array
     *
     * @ORM\Column(name="parameters", type="array", nullable=true)
     */
    private $parameters;

    /**
     * @var integer
     *
     * @ORM\Column(name="timing", type="integer")
     */
    private $timing;

    /**
     * @ORM\OneToMany(targetEntity="Result", mappedBy="target")
     */
    private $results;

    /**
     * @ORM\ManyToOne(targetEntity="Renshan\UserBundle\Entity\User", inversedBy="targets")
     */
    private $user;

    /**
     * @ORM\ManyToMany(targetEntity="ReqGroup", inversedBy="targets")
     * @ORM\JoinTable(name="requests_to_groups")
     */
    private $req_group;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->results = new \Doctrine\Common\Collections\ArrayCollection();
        $this->req_group = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set title
     *
     * @param string $title
     *
     * @return Target
     */
    public function setTitle($title)
    {
        $this->title = $title;

        return $this;
    }

    /**
     * Get title
     *
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * Set url
     *
     * @param string $url
     *
     * @return Target
     */
    public function setUrl($url)
    {
        $this->url = $url;

        return $this;
    }

    /**
     * Get url
     *
     * @return string
     */
    public function getUrl()
    {
        return $this->url;
    }

    /**
     * Set method
     *
     * @param string $method
     *
     * @return Target
     */
    public function setMethod($method)
    {
        $this->method = $method;

        return $this;
    }

    /**
     * Get method
     *
     * @return string
     */
    public function getMethod()
    {
        return $this->method;
    }

    /**
     * Set headers
     *
     * @param array $headers
     *
     * @return Target
     */
    public function setHeaders($headers)
    {
        $this->headers = $headers;

        return $this;
    }

    /**
     * Get headers
     *
     * @return array
     */
    public function getHeaders()
    {
        return $this->headers;
    }

    /**
     * Set parameters
     *
     * @param array $parameters
     *
     * @return Target
     */
    public function setParameters($parameters)
    {
        $this->parameters = $parameters;

        return $this;
    }

    /**
     * Get parameters
     *
     * @return array
     */
    public function getParameters()
    {
        return $this->parameters;
    }

    /**
     * Set timing
     *
     * @param integer $timing
     *
     * @return Target
     */
    public function setTiming($timing)
    {
        $this->timing = $timing;
    }

    /**
     * Get timing
     *
     * @return integer
     */
    public function getTiming()
    {
        return $this->timing;
    }

    /**
     * Add result
     *
     * @param \Renshan\DetectorBundle\Entity\Result $result
     *
     * @return Target
     */
    public function addResult(\Renshan\DetectorBundle\Entity\Result $result)
    {
        $this->results[] = $result;

        return $this;
    }

    /**
     * Remove result
     *
     * @param \Renshan\DetectorBundle\Entity\Result $result
     */
    public function removeResult(\Renshan\DetectorBundle\Entity\Result $result)
    {
        $this->results->removeElement($result);
    }

    /**
     * Get results
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getResults()
    {
        return $this->results;
    }

    /**
     * Set user
     *
     * @param \Renshan\UserBundle\Entity\User $user
     *
     * @return Target
     */
    public function setUser(\Renshan\UserBundle\Entity\User $user = null)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * Get user
     *
     * @return \Renshan\UserBundle\Entity\User
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Add reqGroup
     *
     * @param \Renshan\DetectorBundle\Entity\ReqGroup $reqGroup
     *
     * @return Target
     */
    public function addReqGroup(\Renshan\DetectorBundle\Entity\ReqGroup $reqGroup)
    {
        $this->req_group[] = $reqGroup;

        return $this;
    }

    /**
     * Remove reqGroup
     *
     * @param \Renshan\DetectorBundle\Entity\ReqGroup $reqGroup
     */
    public function removeReqGroup(\Renshan\DetectorBundle\Entity\ReqGroup $reqGroup)
    {
        $this->req_group->removeElement($reqGroup);
    }

    /**
     * Get reqGroup
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getReqGroup()
    {
        return $this->req_group;
    }
}
